<template>
	<view class="setting">
		<NavBar title="设置" :left="true"/>
		<view class="content">
			<view class="list">
				<view class="item" @tap="settingChild('个人信息')" v-if="token">
					<view class="label"> 个人信息 </view>
					<image src="/static/icon/order/right.png" class="i-img"/>
				</view>
				<view class="item" @tap="settingChild('账号安全')" v-if="token">
					<view class="label"> 账号安全 </view>
					<image src="/static/icon/order/right.png" class="i-img"/>
				</view>
				<view class="item" @tap="settingChild('建议反馈')">
					<view class="label"> 建议反馈 </view>
					<image src="/static/icon/order/right.png" class="i-img"/>
				</view>
				<view class="item" @tap="settingChild('关于信购')">
					<view class="label"> 关于信购 </view>
					<image src="/static/icon/order/right.png" class="i-img"/>
				</view>
				<view class="item" @tap="goFunDesc">
					<view class="label"> 功能介绍 </view>
					<image src="/static/icon/order/right.png" class="i-img"/>
				</view>
				<view class="item" @tap="settingChild('公司招聘')">
					<view class="label"> 公司招聘 </view>
					<image src="/static/icon/order/right.png" class="i-img"/>
				</view>
        <view class="item" @tap="call">
        	<view class="label"> 平台客服 </view>
        	<image src="/static/icon/order/right.png" class="i-img"/>
        </view>
				<!-- <view class="item" @tap="settingChild('切换账号')">
					<view class="label"> 切换账号 </view>
					<image src="/static/icon/order/right.png" class="i-img"/>
				</view> -->
			</view>
			<view class="btn" @tap="logout"> 退出登录 </view>
		</view>
	</view>
</template>

<script setup>
  import { computed } from 'vue';
	import { useCommStore, useUserStore } from '@/store/index.js'
	import NavBar from '@/components/NavBar.vue';
  const token = computed(() => useUserStore().token)
	const settingChild = (title) => {
		uni.navigateTo({
			url: `/pages/setting/settingChild?title=${title}`
		})
	}
	const goFunDesc = () => {
		uni.navigateTo({
			url: '/pages/setting/funDesc'
		})
	}
  const call = () => {
    const { comm } = useCommStore()
    uni.makePhoneCall({
      phoneNumber: comm.hellp_mobile
    })
  }
	const logout = () => {
		console.log('logout');
		const { LOGOUT } = useUserStore()
		LOGOUT()
		// LOGOUT()
	}
</script>

<style lang="scss" scoped>
	.setting {
		.content {
			padding: 10px 12px;
		}
		.list {
			width: 100%;
			background-color: #fff;
			border-radius: 10px;
			padding: 0 12px;
			box-sizing: border-box;
			.item {
				width: 100%;
				height: 50px;
				display: flex;
				justify-content: space-between;
				align-items: center;
				border-bottom: #EEEEEE 1px solid;
				&:nth-last-of-type(1) {
					border-bottom: 0;
				}
				.label {
					font-weight: 400;
					font-size: 14px;
					color: #333333;
				}
				.i-img {
					width: 14px;
					height: 14px;
				}
			}
		}
		.btn {
			display: flex;
			align-items: center;
			justify-content: center;
			width: 100%;
			height: 50px;
			color: #3D3D3D;
			font-size: 14px;
			font-weight: 400;
			margin-top: 10px;
			border-radius: 10px;
			background-color: #fff;
		}
	}
</style>
